﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dali.Command;
using Dali.Response;
using DaliUsb;
using Dali.Address;
using System.Threading.Tasks;

namespace TestConsole
{
  class Program
  {
    static void Main(string[] args)
    {
      TridonicDaliUsb usb;
      Task<bool> success;

      usb = new TridonicDaliUsb();
      success = usb.Open();
      success.Wait();

      Console.WriteLine("Status: " + success.Result);

      Console.ReadKey();

      /*
      IEnumerable<string> devicePaths;
      //DirectArcPower dap;
      //DaliResponse res;

      devicePaths = TridonicDaliUsb.FindDevicePaths();

      if (devicePaths.Count() > 0)
      {
        Console.WriteLine("Found these devices");
        foreach (string s in devicePaths)
        {
          Console.WriteLine(s);
        }

        TridonicDaliUsb.SendCommand(new DirectArcPower(new BroadcastAddress(), 0xFE), devicePaths.First());

        Thread.Sleep(1000);

        for (int i = 0; i < 256; i++)
        {
          TridonicDaliUsb.SendCommand(new StepDownAndOff(new GroupAddress(0)), devicePaths.First());
          Thread.Sleep(20);
        }
      }
      else
      {
        Console.WriteLine("No devices found");
      }
      */
    }
  }
}
